package com.heima.apis.wemedia;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannerlDto;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.model.wemedia.pojos.WmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Component;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;
import java.util.Map;


/**
 * @author HNCheng
 * @version 1.0
 * @since 2023/8/2 14:49
 */
@FeignClient("leadnews-wemedia")
@Component
public interface IWemediaClient {

    /**
     * 删除频道
     */
    @GetMapping("/api/v1/channel/del/{id}")
    ResponseResult delete(@PathVariable("id") Integer id);

    /**
     * 查询文章列表
     *
     * @param newsAuthDto
     * @return
     */
    @PostMapping("/api/v1/news/list_vo")
    ResponseResult listVo(@RequestBody NewsAuthDto newsAuthDto);

    /**
     * 查询文章详情
     *
     * @param id
     * @return
     */
    @GetMapping("/api/v1/news/one_vo/{id}")
    ResponseResult wmNewsInfo(@PathVariable Integer id);

    /**
     * 频道名称模糊分页查询
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/channel/list")
    ResponseResult findByNamePage(@RequestBody ChannerlDto dto);

    /**
     * 审核失败
     *
     * @param newsAuthDto
     * @return
     */
    @PostMapping("/api/v1/news/auth_fail")
    ResponseResult authFail(@RequestBody NewsAuthDto newsAuthDto);

    /**
     * 审核成功
     *
     * @param newsAuthDto
     * @return
     */
    @PostMapping("/api/v1/news/auth_pass")
    ResponseResult authPass(@RequestBody NewsAuthDto newsAuthDto);

    /**
     * 新增频道
     *
     * @param wmChannel
     * @return
     */
    @PostMapping("/api/v1/channel/save")
    public ResponseResult save(@RequestBody WmChannel wmChannel);


    /**
     * 修改频道
     *
     * @param wmChannel
     * @return
     */
    @PostMapping("/api/v1/channel/update")
    public ResponseResult update(@RequestBody WmChannel wmChannel);

    /**
     * 敏感词分页查询
     *
     * @param sensitiveDto
     * @return
     */
    @PostMapping("/api/v1/sensitive/list")
    ResponseResult listSensitive(@RequestBody SensitiveDto sensitiveDto);

    /**
     * 敏感词删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/api/v1/sensitive/del/{id}")
    ResponseResult deleteSensitive(@PathVariable("id") Integer id);

    /**
     * 敏感词新增
     *
     * @param wmSensitive
     * @return
     */
    @PostMapping("/api/v1/sensitive/save")
    ResponseResult insertSensitive(@RequestBody WmSensitive wmSensitive);

    /**
     * 敏感词修改
     *
     * @param wmSensitive
     * @return
     */
    @PostMapping("/api/v1/sensitive/update")
    ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive);

    /**
     * 审核文本
     *
     * @param text
     * @return
     */
    @PostMapping("/api/v1/news/scan_text")
    Map<String, String> scanText(@RequestParam String text);

    /**
     * 存入数据到wmUser表中
     *
     * @param wmUser
     */
    @PostMapping("api/v1/wmuser/set")
    void setWmUser(@RequestBody WmUser wmUser);

    /**
     * 通过authorId获取wmUser数据
     *
     * @param authorId
     * @return
     */
    @GetMapping("/api/v1/wmuser/obtain/{authorId}")
    WmUser obtainWmUser(@PathVariable("authorId") Integer authorId);

    /**
     * 查询数据库中channel列表
     * @return
     */
    @GetMapping("/api/vi/channel/select")
    List<WmChannel> selectChannel();
}
